﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewInventory.ascx.cs" Inherits="ERP.Modules.ViewInventory" %>
<%-------------------------------%>
<ext:Hidden ID="FormatTypeViewInventory" runat="server" />
<%--------------GridViewInventory-----------------%>
<ext:Panel ID="PanelViewInventory" runat="server" Layout="Fit" Border="False">
    <Content>
        <ext:GridPanel
            ID="grViewInventory"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <ext:Store
                    ID="StoreViewInventory"
                    runat="server"
                    OnReadData="StoreViewInventory_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model ID="ModelViewInventory" runat="server" GroupField="Warehouse_Name">
                            <Fields>
                                <ext:ModelField Name="Warehouse_Name" Type="String" />
                                <ext:ModelField Name="Materials_Name" Type="String" />
                                <ext:ModelField Name="Materials_Quantity" Type="Int" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="30" Align="Center" />
                    <ext:Column ID="Column1" runat="server" Text="Kho" Width="150" DataIndex="Warehouse_Name"></ext:Column>
                    <ext:Column ID="Column2" runat="server" Text="Vật tư" Width="90" DataIndex="Materials_Name"></ext:Column>
                    <ext:Column ID="Column4" runat="server" Text="Số lượng" Width="100" DataIndex="Materials_Quantity"></ext:Column>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping ID="Grouping1"
                    runat="server"
                    HideGroupedHeader="False"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <View>
                <ext:GridView ID="GridView1" runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar ID="ToolbarTopMain" runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportXML" runat="server" Text="XML" Icon="PageCode">
                                            <Listeners>
                                                <Click Handler="submitValue(#{grViewInventory}, #{FormatTypeViewInventory}, 'xml');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar ID="ToolbarPagging" runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event"></TriggerClick>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:SelectBox
                            ID="SelectBoxViewInventoryWarrehouse"
                            runat="server"
                            Cls="x-select-box"
                            DisplayField="Warehouse_Name"
                            ValueField="Warehouse_Id"
                            MarginSpec="0 8 0 0"
                            EmptyText="Chọn kho">
                            <Store>
                                <ext:Store ID="StoreViewInventoryWarrehouse" runat="server">
                                    <Model>
                                        <ext:Model ID="Model1" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Warehouse_Name" />
                                                <ext:ModelField Name="Warehouse_Id" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Select>
                                    <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:SelectBox>
                        <ext:SelectBox
                            ID="SelectBoxViewInventoryRoom"
                            runat="server"
                            Cls="x-select-box"
                            DisplayField="Room_Name"
                            ValueField="Room_Id"
                            MarginSpec="0 8 0 0"
                            EmptyText="Chọn phòng chứa">
                            <Store>
                                <ext:Store ID="StoreViewInventoryRoom" runat="server">
                                    <Model>
                                        <ext:Model ID="Model2" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Room_Name" />
                                                <ext:ModelField Name="Room_Id" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <DirectEvents>
                                <Select>
                                    <EventMask ShowMask="true" Msg="Đang tải..."></EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:SelectBox>
                        <ext:PagingToolbar ID="PagingToolbarViewInventory" runat="server" StoreID="StoreViewInventory" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
